package com.cfs.svcimpl.bz;

import java.util.List;

import com.cfs.dao.bz.ColumnsDao;
import com.cfs.po.bz.Columns;
import com.cfs.svc.bz.ColumnsService;
import com.cfs.vo.Condition;
import com.cfs.vo.Pager;


public class ColumnsServiceImpl implements ColumnsService {

	private ColumnsDao dao;
	
	public void setDao(ColumnsDao d){
		this.dao = d;
	}


	
	public int deleteById(Long id) {
		return dao.delete(id);
	}

	
	public Long addColumns(Columns c) {
		Long n = dao.insert(c);
		System.out.println("RETURN Columns NUM: " + n + " ID:" + c.getId() );
		return c.getId();
	}

	
	public Long updateColumns(Columns c) {
		return dao.update(c);
	}

	public Columns appSet(String did, Long cid) {
		return dao.appSet(did, cid);
	}

	
	public Columns appGet(String did) {
		return dao.appGet(did);
	}

	public List<Columns> appTops() {
		return dao.appTops();
	}

	
	public Columns get(Long id) {
		Columns c = dao.get(id);
		return c;
	}

	public List<Columns> list(Condition c) {
		return dao.list(c);
	}

	public List<Columns> listSub(Long pid, Pager p) {
		if(p!=null && p.getFirst()==null){
			p = null;
		}
		return dao.listSub(pid>0 ? pid : null, p );
	}

}
